package com.blog.service.impl;

import com.blog.dao.LoginDao;
import com.blog.dao.impl.LoginDaoImpl;
import com.blog.pojo.User;
import com.blog.service.LoginService;

public class LoginServiceImpl implements LoginService {
    private LoginDao loginUserDao = new LoginDaoImpl();

    @Override
    public User login(String username, String password) {
        User user = loginUserDao.findByUserName(username);
        if (user == null) {
            return null; // 用户名不存在
        }
        if (!user.getPassword().equals(password)) {
            return null; // 密码错误
        }
        return user;
    }
}
